// miniprogram/pages/culture/culture-details/culture-details.js
const app = getApp()
let navHeight = app.globalData.navHeight
let windowsHeight = app.globalData.windowsHeight

Page({

  /**
   * 页面的初始数据
   */
  data: {
    titleName: "",
    cardId: "",
    content: "",
    navHeight: "",
    windowsHeight: ""
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.setData({
      titleName: options.card_name,
      cardId: options.card_id,
      navHeight: navHeight,
      windowsHeight: windowsHeight
    })
    
    // 调用云数据库获取内容
    const db = wx.cloud.database()
    let that = this
    db.collection('culture').doc('b8df3bd65f7983ee00eaf201639da5b5').get({
      success: function(res) {
        // console.log(res.data)
        that.setData({
          content: res.data.message[that.data.cardId - 1].content
        })
      }
    })
  }
})